{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nexport default function useTextValueMapping(_ref) {\n  var valueTexts = _ref.valueTexts,\n    onTextChange = _ref.onTextChange;\n  var _React$useState = React.useState(''),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    text = _React$useState2[0],\n    setInnerText = _React$useState2[1];\n  var valueTextsRef = React.useRef([]);\n  valueTextsRef.current = valueTexts;\n  function triggerTextChange(value) {\n    setInnerText(value);\n    onTextChange(value);\n  }\n  function resetText() {\n    setInnerText(valueTextsRef.current[0]);\n  }\n  useLayoutEffect(function () {\n    if (valueTexts.every(function (valText) {\n      return valText !== text;\n    })) {\n      resetText();\n    }\n  }, [valueTexts.join('||')]);\n  return [text, triggerTextChange, resetText];\n}","map":{"version":3,"names":["_slicedToArray","useLayoutEffect","React","useTextValueMapping","_ref","valueTexts","onTextChange","_React$useState","useState","_React$useState2","text","setInnerText","valueTextsRef","useRef","current","triggerTextChange","value","resetText","every","valText","join"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-picker/es/hooks/useTextValueMapping.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport * as React from 'react';\nexport default function useTextValueMapping(_ref) {\n  var valueTexts = _ref.valueTexts,\n      onTextChange = _ref.onTextChange;\n\n  var _React$useState = React.useState(''),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      text = _React$useState2[0],\n      setInnerText = _React$useState2[1];\n\n  var valueTextsRef = React.useRef([]);\n  valueTextsRef.current = valueTexts;\n\n  function triggerTextChange(value) {\n    setInnerText(value);\n    onTextChange(value);\n  }\n\n  function resetText() {\n    setInnerText(valueTextsRef.current[0]);\n  }\n\n  useLayoutEffect(function () {\n    if (valueTexts.every(function (valText) {\n      return valText !== text;\n    })) {\n      resetText();\n    }\n  }, [valueTexts.join('||')]);\n  return [text, triggerTextChange, resetText];\n}"],"mappings":"AAAA,OAAOA,cAAc,MAAM,0CAA0C;AACrE,OAAOC,eAAe,MAAM,kCAAkC;AAC9D,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,eAAe,SAASC,mBAAmB,CAACC,IAAI,EAAE;EAChD,IAAIC,UAAU,GAAGD,IAAI,CAACC,UAAU;IAC5BC,YAAY,GAAGF,IAAI,CAACE,YAAY;EAEpC,IAAIC,eAAe,GAAGL,KAAK,CAACM,QAAQ,CAAC,EAAE,CAAC;IACpCC,gBAAgB,GAAGT,cAAc,CAACO,eAAe,EAAE,CAAC,CAAC;IACrDG,IAAI,GAAGD,gBAAgB,CAAC,CAAC,CAAC;IAC1BE,YAAY,GAAGF,gBAAgB,CAAC,CAAC,CAAC;EAEtC,IAAIG,aAAa,GAAGV,KAAK,CAACW,MAAM,CAAC,EAAE,CAAC;EACpCD,aAAa,CAACE,OAAO,GAAGT,UAAU;EAElC,SAASU,iBAAiB,CAACC,KAAK,EAAE;IAChCL,YAAY,CAACK,KAAK,CAAC;IACnBV,YAAY,CAACU,KAAK,CAAC;EACrB;EAEA,SAASC,SAAS,GAAG;IACnBN,YAAY,CAACC,aAAa,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC;EACxC;EAEAb,eAAe,CAAC,YAAY;IAC1B,IAAII,UAAU,CAACa,KAAK,CAAC,UAAUC,OAAO,EAAE;MACtC,OAAOA,OAAO,KAAKT,IAAI;IACzB,CAAC,CAAC,EAAE;MACFO,SAAS,EAAE;IACb;EACF,CAAC,EAAE,CAACZ,UAAU,CAACe,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;EAC3B,OAAO,CAACV,IAAI,EAAEK,iBAAiB,EAAEE,SAAS,CAAC;AAC7C"},"metadata":{},"sourceType":"module"}